package com.neu.envprotection.airQuality.controller;

import com.neu.envprotection.airQuality.dao.entity.AirQuality;
import com.neu.envprotection.airQuality.dto.req.UserSelectReqDto;
import com.neu.envprotection.airQuality.dto.resp.AirQualityRespDto;
import com.neu.envprotection.airQuality.dto.resp.GetAQIDistributionRespDto;
import com.neu.envprotection.airQuality.dto.resp.GetAQITrendRespDto;
import com.neu.envprotection.airQuality.dto.resp.GetProvinceAQIRespDto;
import com.neu.envprotection.airQuality.service.InvestigatorService;
import com.neu.envprotection.common.constant.SystemConfigConsts;
import com.neu.envprotection.common.resp.RestResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/inner/investigator")
@RequiredArgsConstructor
@SecurityRequirement(name = SystemConfigConsts.HTTP_AUTH_HEADER_NAME)
@Tag(name = "空气质量微服务内部接口")
@Slf4j
public class InnerInvestigatorController {
    @Autowired
    private InvestigatorService investigatorService;

    @PostMapping("/addAQI")
    @Operation(summary = "内部调用添加实际调查记录")
    private RestResp<Void> getProvinceAQI(@RequestBody AirQuality airQuality){
        System.out.println(airQuality);
        return investigatorService.addAirQuality(airQuality);
    }

    @PostMapping("/getProvinceAQI")
    @Operation(summary = "内部调用省AQI")
    private RestResp<List<GetProvinceAQIRespDto>> getProvinceAQI(){
        return investigatorService.getProvinceAQI();
    }

    @PostMapping("/getAQIDistribution")
    @Operation(summary = "内部调用AQI分布")
    private RestResp<List<GetAQIDistributionRespDto>> getAQIDistribution(){
        return investigatorService.getAQIDistribution();
    }

    @PostMapping("/getAQITrend")
    @Operation(summary = "内部调用AQI趋势")
    private RestResp<List<GetAQITrendRespDto>> getAQITrend(){
        return investigatorService.getAQITrend();
    }



}
